package day230323;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/3/25 9:29
 */
public class Main1 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.nextLine(); // aba
        String s2 = scan.nextLine(); // b
        int resCount = 0; // 用于记录回文结果的个数
        for (int i = 0; i <= s1.length(); i++) {
            // 逐个位置插入 进行尝试
            StringBuilder stringBuilder = new StringBuilder(s1);
            stringBuilder.insert(i, s2);
            if (isAPalindromeString(stringBuilder.toString())) {
                // 如果是回文字符串
                resCount++;
            }
        }
        // 打印结果
        System.out.print(resCount);
    }

    // 判断是否为回文字符串
    private static boolean isAPalindromeString(String s) {
        int startIndex = 0;
        int endIndex = s.length() - 1;
        while (startIndex < endIndex) {
            if(!(s.charAt(startIndex) == s.charAt(endIndex))) {
                return false;
            }
            startIndex++;
            endIndex--;
        }
        return true;
    }
}
